package com.woniuxy.demo.epai.service.impl;

import com.woniuxy.demo.epai.model.ProductParameter;
import com.woniuxy.demo.epai.dao.ProductParameterMapper;
import com.woniuxy.demo.epai.service.IProductParameterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author epai
 * @since 2021-04-12
 */
@Service
public class ProductParameterServiceImpl extends ServiceImpl<ProductParameterMapper, ProductParameter> implements IProductParameterService {

    @Autowired
    private ProductParameterMapper mapper;

    /**
     * 新增商品参数
     * @param form
     * @return
     */
    @Override
    public int addProductParameter(ProductParameter form) {
        int line = mapper.addProductParameter(form);
        return line;
    }

    @Override
    @Cacheable(value="productParameter",key = "'productParameter_'+#par_id")
    public ProductParameter queryParameterById(int par_id) {
        ProductParameter productParameter = mapper.selectById(par_id);
        return productParameter;
    }
}
